package com.cxm.helper.task;

import cn.hutool.json.JSONUtil;
import com.cxm.helper.pojo.UserLike;
import com.cxm.helper.service.UserLikeService;
import lombok.extern.slf4j.Slf4j;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.quartz.QuartzJobBean;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author: chenximeng
 * @date: 2022/11/30 16:26
 */
@Slf4j
@Component
public class UserLikeTask extends QuartzJobBean {

    @Autowired
    UserLikeService userLikeService;

    @Override
    protected void executeInternal(JobExecutionContext jobExecutionContext) {
        log.info("执行用户点赞持久化任务");
        userLikeService.transLikedFromRedis2DB();
        log.info("用户点赞持久化任务结束");
        log.info("执行持久化点赞数任务");
        userLikeService.transLikedNumFromRedis2DB();
        log.info("持久化点赞数任务结束");

    }
}
